program Geometry;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  x0, y0, x1, y1, x2, y2: Integer;
  r1, r2, xp, yp, a, b, c, d, r: Real;
  fin: TextFile;

begin
  AssignFile (fin, 'input.txt');
  Reset (fin);
  Read (fin, x0);
  Readln (fin, y0);
  Read (fin, x1);
  Readln (fin, y1);
  Read (fin, x2);
  Read (fin, y2);
  a:=y1-y2;
  b:=x2-x1;
  c:=x1*y2-x2*y1;
  d:=(a*x0+b*y0+c)/(sqrt(a*a+b*b));
  xp:=x0-(a*d/((sqrt(a*a+b*b))));
  yp:=y0-(b*d/((sqrt(a*a+b*b))));
  if ((x2-xp)*(x1-xp) <= 0) and ((y2-yp)*(y1-yp) <= 0) then
  begin
    r:=sqrt((xp-x0)*(xp-x0)+(yp-y0)*(yp-y0));;
  end else begin
    r1:=sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0));
    r2:=sqrt((x2-x0)*(x2-x0)+(y2-y0)*(y2-y0));
    if r1 > r2 then
    begin
      r:=r2;
    end else begin
      r:=r1;
    end;
  end;
  Writeln (r:0:3);
  Readln;
  CloseFile (fin);
end.
